const chalk = require('chalk');
const {terser} = require('rollup-plugin-terser');
const cleanup = require('rollup-plugin-cleanup');
const commonjs = require('rollup-plugin-commonjs');
const jsonInfo = require('@rollup/plugin-json');
const {version} = require('./package.json')
const nodeResolve = require('rollup-plugin-node-resolve');
// const babel = require('rollup-plugin-babel')
/**
 * 支持ES5，打开babel转换，体积会大一些。
 */
console.log(chalk.green('正在构建iife工具包......当前版本号：%s'), version);
module.exports = {
    input: 'src/index.js',
    output: {
        file: 'dist/businessTools.js',
        format: 'iife',
        name: 'businessTools'
    },
    plugins: [
        nodeResolve(),
        commonjs(),
        terser(
            {
                compress: {
                    pure_funcs: ['console.log']
                },
            }
        ),
        cleanup(),
        jsonInfo(),
        // babel({
        //     exclude: 'node_modules/**'
        // }),
    ]
};


